﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CustomerUI
{
    /// <summary>
    /// Interaction logic for MainUI.xaml
    /// </summary>
    public partial class MainUI : Page
    {
        const int BlurRadius = 10;
        public MainUI()
        {
            MainWindow.schedule.StartRefresh();
            InitializeComponent();    
            
        }
        private void ChooseMovie(object sender, RoutedEventArgs e)
        {            
            MainWindow.schedule.SetDealSelected((sender as Button).Tag);
            (App.Current.MainWindow as MainWindow).pagContentFrameSource = MainWindow.pageDetailUI;
        }

        private void Register_Click(object sender, RoutedEventArgs e)
        {
            (App.Current.MainWindow as MainWindow).blurEffect.Radius = BlurRadius;
            (new Register()).ShowDialog();
        }

        private void SignIn_Click(object sender, RoutedEventArgs e)
        {
            (App.Current.MainWindow as MainWindow).blurEffect.Radius = BlurRadius;
            (new Login()).ShowDialog();
        }

        private void ChangeLanguage(object sender, RoutedEventArgs e)
        {
            ResourceDictionary dict = new ResourceDictionary();
            switch ((sender as Button).Uid)
            {
                case "English":
                    dict.Source = new Uri("..\\Languages\\en-us.xaml", UriKind.Relative);
                    break;
                case "Vietnamese":
                    dict.Source = new Uri("..\\Languages\\vi-vn.xaml", UriKind.Relative);
                    break;
            }
            Application.Current.Resources.MergedDictionaries.Add(dict);
        }

    }
}
